package com.rd.student.jiaji.class4.suyan.zrrd.day13;

public class StringTest {
    public static void main(String[] args) {
        /*String str="zhang";
        String str1=new String("zhang");
        System.out.println(str==str1);

         */
        String str = new String("zhang");
        str = str.intern();
        String str1 = "zhang";
        System.out.println(str == str1);
        System.out.println("---------------");
        String str2 = new String("zhang") + new String("san");
        str2.intern();
        String str3 = "zhangsan";
        System.out.println(str2 == str3);
        System.out.println("---------------");
        String str4 = new String("zhang") + new String("san");
        String str5 = "zhangsan";
        str4.intern();
        System.out.println(str4 == str5);
        System.out.println("---------------");
        String str6 = new String("zhang") + new String("san");
        String str7 = "zhangsan";
        str6 = str6.intern();
        System.out.println(str6 == str7);

    }
}